package action;

import java.util.List;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import dao.DeptDao;
import entity.Dept;
@ParentPackage("struts-default")
@Namespace("/dept")
@Controller
@Scope("prototype")
public class DeptListAction {
	@Resource
	private DeptDao deptDao;
	private List<Dept> depts;
  
	public DeptDao getDeptDao() {
		return deptDao;
	}

	public void setDeptDao(DeptDao deptDao) {
		this.deptDao = deptDao;
	}

	public List<Dept> getDepts() {
		return depts;
	}

	public void setDepts(List<Dept> depts) {
		this.depts = depts;
	}

	@Action(value="list",results={
			@Result(name="success",type="dispatcher",location="/dept_list.jsp")
	})
	public String excute(){
		depts=deptDao.findAll();
		return "success";
    	
    }
}
